import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import './plugins/element.js'
import '../src/assets/css/globle.css'
import axios from 'axios'
import moment from 'moment'
import TreeTable from 'vue-table-with-tree-grid'
//导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'

import qs from 'qs'
import NProgress from 'nprogress'
Vue.prototype.$qs = qs
Vue.component('tree-table', TreeTable)
//配置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//在request 拦截器中 展示进度条 NProgress.start()
axios.interceptors.request.use(config => {
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  //在最后必须return config
  return config
})
//在response拦截器中 隐藏进度条  NProgress.done()
axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})
// 设置本地时区
moment.locale('zh-cn')
Vue.prototype.$moment = moment
Vue.prototype.$http = axios
Vue.config.productionTip = false
//将富文本编辑器， 注册为全局可用的组件
Vue.use(VueQuillEditor)
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
